package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import com.heima.wemedia.service.WmNewsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 自媒体图文内容信息表 前端控制器
 * </p>
 ## findList

 **接口地址**:`/api/v1/news/list`


 **请求方式**:`POST`

 **请求数据类型**:`application/json`
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/news")
public class WmNewsController {

    @Autowired
    private WmNewsService  wmNewsService;


    @PostMapping("/submit")
    public ResponseResult submitNews(@RequestBody WmNewsDto dto){
        return  wmNewsService.submitNews(dto);
    }

    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmNewsPageReqDto dto){
        return  wmNewsService.findList(dto);
    }


    @PostMapping("/down_or_up")
    public ResponseResult downOrUp(@RequestBody WmNewsDto dto){

        return  wmNewsService.downOrUp(dto);
    }

    @PostMapping("/list_vo")
    public ResponseResult listVo(@RequestBody NewsAuthDto dto){
        return wmNewsService.listVo(dto);
    }

    @GetMapping("/one_vo/{id}")
    public ResponseResult findDetails(@PathVariable ("id") Integer id){
        return wmNewsService.findDetails(id);
    }

    @PostMapping("/auth_fail")
    public ResponseResult isNot(@RequestBody NewsAuthDto dto){
        return wmNewsService.isNot(dto);
    }
    @PostMapping("/auth_pass")
    public ResponseResult isYes(@RequestBody NewsAuthDto dto){
        return wmNewsService.isYes(dto);
    }

}
